/* eslint-disable no-unused-vars */
/* eslint-disable import/no-duplicates */
import Vue from 'vue'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import App from './App.vue'
import router from './router'

// 导入字体图标样式

import './assets/fonts/iconfont.css'

// 导入全局样式

import './assets/css/global.css'

// 配置axios包发送请求

import axios from 'axios'

// 手动配置 element-ui

// import 'element-ui/lib/theme-chalk/index.css'
// import './plugins/element.js'

// 配置axios的请求根路径

axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
axios.interceptors.request.use(config => {
  // console.log(config)
  config.headers.Authorization = window.sessionStorage.getItem('token')
  return config
})
// 将axios赋值给vue实例对象,这样就可以通过this访问$http从而发起ajax请求

Vue.prototype.$http = axios

// eslint-disable-next-line no-undef
Vue.use(ElementUI)

Vue.config.productionTip = false

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
